/*
 * InputParser.h
 *
 *  Created on: 2012-04-22
 *      Author: mm
 *
 *      This class represents a parser for parsing input lines into tokens for the generator.
 *      Implements singleton pattern.
 */

#ifndef INPUTPARSER_H_
#define INPUTPARSER_H_

#include <vector>
#include <string>


class InputParser
{
public:
	typedef std::vector<std::string> Tokens;

	/**
	 *  Singleton class - new instances of it cannot be created
	 *  and the only instance can be obtained via the getInstance() method.
	 */
	static InputParser* getInstance()
	{
		if(!instance_)
			instance_ = new InputParser();
		return instance_;
	}

	/**
	 * 	Parses input line and returns it as a vector of tokens.
	 */
	Tokens parseLine(const std::string& line);



private:
	InputParser() {}
	InputParser(const InputParser&) {}
	virtual ~InputParser() {}

	static InputParser* instance_;
};

#endif /* INPUTPARSER_H_ */
